version 14.0
log using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\africancabinets_multi_region.log", replace
set more off
#delimit ;

*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      africancabinets16_multi_region.do               *;
*       Date:           March 22, 2017                                  *;
*       Author:         Molly Ariotti and Sona Golder                   *;
*       Purpose:      	Replicate results for CPS African portfolio     *;
*                       allocation paper, using Africa data 1990-2014.  *;
* 	    Input File:     Africa.dta, Europe.dta, America.dta             *;
*       Output File:    africancabinets16_multi_region.log              *;
*       Data Output:    none                                            *;             
*       Previous file:  none                                            *;
*       Machine:        laptop                           				*;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Open and summarize dataset.                                     *;
*     ****************************************************************  *;

use "\Users\sgolder\Dropbox\Portfolio Allocation\replication\Africa.dta"; 

sum;

desc;


*     ****************************************************************  *;
*       Drop African cabinets where there is no formateur coded.        *;
*       (One in Guinea-Bissau, one in Sao Tome & Principe               *;
*     ****************************************************************  *;

drop if cabinetcode == 5;
drop if cabinetcode == 23;

*     ****************************************************************  *;
*       Add Europe data from Warwick and Druckman (2006)                *;
*     ****************************************************************  *;

append using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\Europe.dta"; 

*     ****************************************************************  *;
*       Drop European cabinets where there is no formateur coded.       *;
*      (These are caseno 531, 532, 533, 534, 542,543, 617, 858, 859)    *;
*     ****************************************************************  *;

drop if code == 205097;
drop if code == 205098;
drop if code == 205099;
drop if code == 205100;
drop if code == 205108;
drop if code == 205109;
drop if code == 207130;
drop if code == 209184;
drop if code == 209185;

*     ****************************************************************  *;
*       Add Latin American data from Almeida (2003)                     *;
*     ****************************************************************  *;

append using "\Users\sgolder\Dropbox\Portfolio Allocation\replication\America.dta"; 

*     ****************************************************************  *;
*       Create regional dummy variables                                 *;
*     ****************************************************************  *;

gen africa = . ;
replace africa = 1 if region==1;
replace africa = 0 if region==2;
replace africa = 0 if region==3;

gen europe = . ;
replace europe = 0 if region==1;
replace europe = 1 if region==2;
replace europe = 0 if region==3;

gen america = . ;
replace america = 0 if region==1;
replace america = 0 if region==2;
replace america = 1 if region==3;

*     ****************************************************************  *;
*       Create interaction terms for analysis in Table 1                *;
*     ****************************************************************  *;

gen seatshare_africa=africa*seatshare;
gen formateur_africa=africa*formateur;

*     ****************************************************************  *;
*     ****************************************************************  *;
*       Produce results in Table 2 (without formateur).                 *;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Model 1 combined (Africa + Europe), 285 cabinets                *;
*     ****************************************************************  *;

regress portfolioshare seatshare africa seatshare_africa if region != 3, robust;

*     ****************************************************************  *;
*       Model 2 Europe, 259 cabinets                                    *;
*     ****************************************************************  *;

regress portfolioshare seatshare if europe==1, robust;

*     ****************************************************************  *;
*       Is coefficient on seatshare 1? [No.]                              *;
*     ****************************************************************  *;

test seatshare=1;

*     ****************************************************************  *;
*       Model 3 Africa, 26 cabinets                                     *;
*     ****************************************************************  *;

regress portfolioshare seatshare if africa==1, robust;

*     ****************************************************************  *;
*       Is coefficient on seatshare 1? [Cannot reject]                  *;
*     ****************************************************************  *;

test seatshare=1;


*     ****************************************************************  *;
*     ****************************************************************  *;
*       Produce results in Table 2 (with formateur).                    *;
*     ****************************************************************  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Model 4 combined (Africa + Europe)                              *;
*     ****************************************************************  *;
 
regress portfolioshare seatshare formateur africa seatshare_africa formateur_africa  if region != 3, robust;

lincom formateur + formateur_africa;

*     ****************************************************************  *;
*       Model 5 Europe                                                  *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if europe==1, robust;

*     ****************************************************************  *;
*       Model 6 Africa                                                  *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if africa==1, robust;

*     ****************************************************************  *; 
*       Replication of Table 2 in main text complete                    *;
*     ****************************************************************  *; 

*     ****************************************************************  *;
*                   Supplementary Analyses                              *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Run models for Table in Appendix C (similar to Table 1, but     *;
*       including Latin American data.                                  *;
*       Note that Latin American data comprises 215 cabinet parties     *;
*       in 74 cabinets in 10 countries                                  *;
*     ****************************************************************  *;

*     ****************************************************************  *;
*       Model 1 Europe                                                  *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if region==2, robust;

*     ****************************************************************  *;
*       Model 2 Latin America                                           *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if region==3, robust;

*     ****************************************************************  *;
*       Model 3 Africa Pooled                                           *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if region==1, robust;

*     ****************************************************************  *;
*       Model 4 Africa Parliamentary                                    *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if region==1 & presidential==0, robust;

*     ****************************************************************  *;
*       Model 5 Africa Presidential                                     *;
*     ****************************************************************  *;

regress portfolioshare seatshare formateur if region==1 & presidential==1, robust;



*     ****************************************************************  *; 
*       Table 2 Robustness check with clustering - results robust       *;
*     ****************************************************************  *; 

regress portfolioshare seatshare africa seatshare_africa if region != 3, cluster(cabinetcode);
regress portfolioshare seatshare if europe==1, cluster(cabinetcode);
regress portfolioshare seatshare if africa==1, cluster(cabinetcode);
regress portfolioshare seatshare formateur africa seatshare_africa formateur_africa if region != 3, cluster(cabinetcode);
regress portfolioshare seatshare formateur if europe==1, cluster(cabinetcode);
regress portfolioshare seatshare formateur if africa==1, cluster(cabinetcode);

*     ****************************************************************  *; 
*       Repeat with bootstrap clustering - results robust.              *;
*     ****************************************************************  *; 

regress portfolioshare seatshare africa seatshare_africa if region != 3, vce(boot, cluster(cabinetcode) reps(400) seed(10101));
regress portfolioshare seatshare if europe==1, vce(boot, cluster(cabinetcode) reps(400) seed(10101));
regress portfolioshare seatshare if africa==1, vce(boot, cluster(cabinetcode) reps(400) seed(10101));
regress portfolioshare seatshare formateur africa seatshare_africa formateur_africa if region != 3, vce(boot, cluster(cabinetcode) reps(400) seed(10101));
regress portfolioshare seatshare formateur if europe==1, vce(boot, cluster(cabinetcode) reps(400) seed(10101));
regress portfolioshare seatshare formateur if africa==1, vce(boot, cluster(cabinetcode) reps(400) seed(10101));

*     ****************************************************************  *;
*       Jacknife procedures (drop one government)                       *;
*     ****************************************************************  *;

regress portfolioshare seatshare africa seatshare_africa if region != 3, vce(jackknife, cluster(cabinetcode));
regress portfolioshare seatshare if europe==1, vce(jackknife, cluster(cabinetcode));
regress portfolioshare seatshare if africa==1, vce(jackknife, cluster(cabinetcode));
regress portfolioshare seatshare formateur africa seatshare_africa formateur_africa if region != 3, vce(jackknife, cluster(cabinetcode));
regress portfolioshare seatshare formateur if europe==1, vce(jackknife, cluster(cabinetcode));
regress portfolioshare seatshare formateur if africa==1, vce(jackknife, cluster(cabinetcode));


*     ****************************************************************  *;
*       Jacknife procedures (drop one country)                          *;
*     ****************************************************************  *;

regress portfolioshare seatshare africa seatshare_africa if region != 3, vce(jackknife, cluster(countrycode));
regress portfolioshare seatshare if europe==1, vce(jackknife, cluster(countrycode));
regress portfolioshare seatshare if africa==1, vce(jackknife, cluster(countrycode));
regress portfolioshare seatshare formateur africa seatshare_africa formateur_africa if region != 3, vce(jackknife, cluster(countrycode));
regress portfolioshare seatshare formateur if europe==1, vce(jackknife, cluster(countrycode));
regress portfolioshare seatshare formateur if africa==1, vce(jackknife, cluster(countrycode));



log close;
exit;
